home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / libscsi1.zoo / LibScsi-0.01 / README < prev    next >
Encoding:
Text File  |  1994-03-15  |  11.1 KB  |  225 lines

  1.                     Atari ST SCSI Interface Library
  2.                            For C Programmers
  3.                              Version 0.01
  4.  
  5.                  Copyright Steve Woodford, August 1993
  6.  
  7.  
  8. OVERVIEW:
  9. The source files in this directory implement a nice easy SCSI interface which
  10. can be used by C programmers. The idea is that any type of SCSI device can be
  11. handled through a common interface with similar semantics to Unix read() and
  12. write() system calls. The library is distributed in source form only, since
  13. there is no absolute standard for object library format. At the moment, it is
  14. likely that this code will only compile under Gnu C, so if you use another
  15. C compiler, you will have to massage the Makefile and assembler source files.
  16.  
  17. Currently, this code is a beta-test release and will be updated as bug reports
  18. arrive. At the moment, unless someone else writes a low-level driver for the
  19. Falcon and TT SCSI buses, only the ST and STE ACSI bus is supported.
  20.  
  21. There is no formal documentation supplied at the moment, as this is a bit of
  22. a rush release. However, if you decide to write an application around this
  23. code, you will probably be proficient enough in C to understand how to use
  24. it anyway! Documentation will be supplied in some future version though.
  25.  
  26.  
  27. DISCLAIMER:
  28. I make no claims as to the suitability of this software to perform it's
  29. intended task and/or any task envisaged by you as a programmer. I will not
  30. be held responsible for any damage or loss through your use or inability to
  31. use this software. Basically, by all means report bugs and/or send me a wish
  32. list but _don't_ hold me responsible when anything goes wrong!
  33.  
  34. Ok, I had to say that; there are unreasonable people out there....
  35.  
  36. Please note, however, that this library gives you unrestricted access to
  37. devices hooked onto your SCSI bus. This includes the hard disk drive
  38. containing your valuable data. Unless you know exactly what you're doing,
  39. don't *ever* attempt to write to an active GEM / MiNT partition on your disk
  40. with this library; more than likely, you will damage data and/or make the
  41. partition unusable. TOS certainly does not like hard disk data being altered
  42. under its nose, to say nothing of the cache your hard disk driver program
  43. may contain. The golden rule is "Always make regular backups". Oh, and if
  44. you do use this library to write backup program, keep an executable of
  45. the restore program on floppy. (Better still, several floppies...)
  46.  
  47.  
  48. CONTENTS:
  49. The 'zoo' archive containing this library should contains the following files:
  50.  
  51.    README       - This file 'wot' you are currently reading.
  52.    Makefile     - Makefile setup for Gnu C. Edit for -mshort library
  53.    Patchlev.c   - Revision level of the library
  54.    scsi.h       - Low-level interface. Put this in your include/sys directory
  55.    scsi_io.h    - SCSI I/O interface. Put this in your include/sys directory
  56.    libscsi.h    - Library specific header. Only needed by library routines
  57.    scsi_io.c    - SCSI I/O functions. Uses the following files to implement
  58.                   the high level interface:
  59.  
  60.    erase.c filemark.c inquire.c load.c mod_sens.c prevent.c req_sens.c
  61.    rezero.c rw_rand.c rw_seq.c seek_rnd.c seek_seq.c space.c test_rdy.c
  62.    timeout.c to.c
  63.  
  64.    scsicmd.cpp  - This assembler file implements the lowest level of the
  65.                   library; ie. the part which actually issues SCSI commands
  66.                   on the ST's ACSI bus.
  67.  
  68.    cfile.c      - This is in my own library of useful functions, but since
  69.                   the SCSI library uses it, I have included it here. It
  70.                   simply provides an easy way to handle ASCII configuration
  71.                   files from within programs.
  72.    cfile.h      - Header file for above. Put in your 'include' directory.
  73.    scsi.cnf     - Example configuration file. Good for an Archive Viper 2150,
  74.                   with SCSI ID of 2.
  75.  
  76.    tape.c       - Lifted from my backup/restore program, this shows how the
  77.                   SCSI library can be used. This is only a code fragment
  78.                   implementing the tape side of my backup program but serves
  79.                   as a short, useful example.
  80.  
  81.  
  82. HISTORY:
  83. I wrote this library after buying a secondhand Archive Viper 2150 tapedrive.
  84. At the time, I didn't have access to Internet or Usenet so I had no idea
  85. what the rest of the world was doing. As it turned out, there was very little
  86. software available to support tapedrives on the ST so writing my own was
  87. probably a good move.
  88.  
  89. The library went through a few 'mutations' before this version emerged as
  90. the best way to implement the interface. Initially, it was specific to
  91. SCSI tapedrives, since that was my only requirement. However, I realised
  92. quite quickly that it would be easy to make it generic, so that it could
  93. support almost any SCSI device which could be hung off the ACSI bus.
  94.  
  95. At this point, I have to say that I don't have access to much hardware
  96. with which to test this library; only the aforementioned tapedrive and
  97. my hard diskdrive. So I would appreciate comments from programmers who
  98. have more exotic devices.
  99.  
  100.  
  101. CONFIGURATION:
  102. The library is mostly self-configuring in terms of finding out what a
  103. particular SCSI device is. However, certain things are not obvious.
  104. Most importantly, different SCSI devices take different lengths of time to
  105. complete an operation. In the case of a hard disk, this is generally a very
  106. short time, ranging from a few tens of milliseconds to perhaps one or two
  107. seconds if the drive recalibrates itself or retries a read/write error.
  108.  
  109. SCSI tapedrives, however, take much longer to complete operations. Take,
  110. for example, writing the first block of data to a tape you've just
  111. inserted in the drive. This tape may need to be rewound. The drive may
  112. need to write a head calibration track if the tape is brand new. In short,
  113. tapedrive operations may take many tens of seconds, perhaps several minutes.
  114.  
  115. In this case, you have to provide some way to tell the SCSI library just
  116. what timeouts to apply to a particular device. This is where the 'scsi.cnf'
  117. file comes in. When you first call 'scsi_open()', the library will look
  118. for a 'scsi.cnf' file in the current directory. If that fails, the
  119. environment is searched for a variable named 'SCSI_CONFIG_FILE' which
  120. contains a pathname to a scsi.cnf file. (eg. c:\etc\scsi.cnf) If the
  121. library cannot find a scsi.cnf file, default timeout values are assumed.
  122. Note: The defaults are good only for most hard disk drives....
  123.  
  124. An example 'scsi.cnf' file is supplied with the library. This is the file
  125. I use on my system. If you read it, you will see that my tapedrive is
  126. set up as SCSI ID#2, and is marked as the 'Default Tapedrive'. If I call
  127. 'scsi_open()' with the magic SCSI ID of 'SCSI_TAPE_ID', the library will
  128. automatically use the default tape defined in the scsi.cnf file. This way,
  129. your software doesn't need to worry about finding the tapedrive in a user's
  130. system...
  131.  
  132. The scsi.cnf file also defines a device's timeout values. The library looks
  133. in the file for an entry: SCSI_TIMEOUT_<id>, where <id> is the device's
  134. SCSI ID. This contains a list of comma separated values defining the maximum
  135. time, in seconds, to wait for a particular operation to complete. The example
  136. scsi.cnf file contains the definition for my Archive Viper tapedrive.
  137.  
  138.  
  139. PERFORMANCE:
  140. First of all, don't expect to be able to use this library to obtain
  141. blistering I/O speed on hard diskdrives. Although actual data transfer will
  142. occur at the maximum speed achievable by the device, there is significant
  143. overhead in the library such that the average throughput will probably be
  144. slower than the hard disk driver software you currently use. The main
  145. bottleneck is in the separation of 'read/write' and 'seek', where you have
  146. to 'seek' to a particular block before you can start reading from there.
  147. Note that the 'scsi_seek()' call doesn't involve any head movement, it simply
  148. updates the starting block number for the next 'scsi_read()' or 'scsi_write()'
  149. calls.  (Also note that 'scsi_seek()' is meaningless for tape-drives, use the
  150. 'scsi_ioctl()' call instead.)
  151.  
  152. Remember though, that the main intent of this library is to support devices
  153. which your current disk driver can't, and to provide a clean, easy to to use
  154. method of accessing them.
  155.  
  156. I have already incorporated this library into a backup/restore program
  157. which can read and write Unix TAR, and CPIO format tapes. So far, the
  158. performance is very good, i.e. my ST can keep the tape streaming pretty
  159. well; I can backup my 80meg drive onto one tape in less than half an
  160. hour, and that's with a mixture of GEM and MinixFS partitions. Performance
  161. deteriorates, however, for badly fragmented drives and/or drives with lots
  162. of small files. (Don't hold your breath for this backup/restore program.
  163. I want to wrap a GEM interface around it before releasing it. I would also
  164. like the library to work with the Falcon and TT so that the backup program
  165. is fully compatible).
  166.  
  167.  
  168. MiNT COMPATIBILITY:
  169. I updated the library earlier this year, after getting net access, to
  170. be compatible with MiNT and MiNTLIBS. So far, no problems. In fact, only
  171. a small part of the low-level assembly code needed changing.
  172.  
  173.  
  174. HARDWARE COMPATIBILITY:
  175. Currently, only ST, STE, STacy and derived systems are supported. However,
  176. a future version will support other hardware, and may well use the
  177. 'dma_read' & 'dma_write' system calls supported by newer versions of TOS.
  178. As yet, though, I'm unsure if these calls can support SCSI tapes since the
  179. SCSI command descriptor block (CDB) for tapedrives is slightly different to
  180. hard diskdrives. These calls certainly do not allow for transfers of less
  181. than 512 bytes; something which is essential for several SCSI commands.
  182.  
  183.  
  184. COPYING:
  185. This library is public domain. I don't expect to make any money out of
  186. it. I do retain copyright on the library, however. Don't feel obliged to
  187. donate anything my way, just go down the pub and buy yourself a pint
  188. instead :-} and pretend you bought me it! (My backup program will probably
  189. be Shareware, though)
  190.  
  191. You have my permission to distribute verbatim copies of this library
  192. just so long as you don't charge for the software. You can make a
  193. reasonable charge for the storage media, eg. floppy disk/s, however.
  194.  
  195. If you modify the library, be sure to credit yourself and comment where
  196. and what you changed. I don't want to be blamed for other peoples'
  197. mistakes!
  198.  
  199. If you use this library in your own application/s, you may charge as much
  200. as you like if you decide to sell it. I only ask that you mention in your
  201. documentation the fact that this library is used.
  202.  
  203.  
  204. UPDATES:
  205. Please let me know what you think about this library. Tell me if you
  206. find a bug, of which I am sure there are many. If you do tell me about a bug,
  207. give me as much information as possible about how you found the bug. If you
  208. know of a fix for the bug, even better; send me the file/s you updated.
  209. Especially welcome are modifications to the library to support other SCSI
  210. device types, or Atari hardware. However, please quote the version number of
  211. the library which applies in your case. I may already have an updated version
  212. which has had your particular bug fix, or feature implemented. You will find
  213. your version number in 'Patchlev.c'.
  214.  
  215.  
  216. Happy hacking, Steve.
  217. March 15th, 1994
  218.  
  219. Stephen Woodford
  220. 11054 ne 33rd Place, #B2
  221. BELLEVUE, WA 98004
  222. USA
  223.  
  224. e-mail: woodford@esca.com
  225.